﻿function UpdateColorPicker(red, green, blue, preview)
{
    var r = parseInt(red.value,10);
    var g = parseInt(green.value,10);
    var b = parseInt(blue.value,10);
    
    r = r.toString(16);
    g = g.toString(16);
    b = b.toString(16);
    
    if (r.length == 1) r = '0' + r;
    if (g.length == 1) g = '0' + g;
    if (b.length == 1) b = '0' + b;
    var color = '#' + r + g + b;
        
    preview.style.background = color;    
}